package app.modules.infrastructure.notification.support;

import app.q.StringUtil;
import jasmine.framework.common.util.CheckUtil;
import jasmine.framework.common.util.ErrorUtil;

import java.io.IOException;
import java.io.Writer;

/**
 * @author mh.z
 */
public class SimpleNotificationData implements NotificationData {
    private String content;

    public SimpleNotificationData(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    @Override
    public void getContent(Writer writer) {
        CheckUtil.notNull(writer, "writer null");

        if (StringUtil.isNotEmpty(content)) {
            try {
                writer.write(content);
            } catch (IOException e) {
                throw ErrorUtil.sneakyError(e);
            }
        }
    }

}
